<template>
  <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
    <div class="container">
      <router-link class="navbar-brand" :to="{name : 'home'}">King Of Bots</router-link>
      <div class="collapse navbar-collapse" id="navbarText">
        <ul class="navbar-nav me-auto mb-2 mb-lg-0">
          <li class="nav-item">
            <router-link :class="routeName === 'pkIndex' ? 'nav-link active' : 'nav-link'" :to="{name : 'pkIndex'}">
              对战
            </router-link>
          </li>
          <li class="nav-item">
            <router-link :class="routeName === 'recordIndex' ? 'nav-link active' : 'nav-link'"
                         :to="{name : 'recordIndex'}">对局列表
            </router-link>
          </li>
          <li class="nav-item">
            <router-link :class="routeName === 'rankListIndex' ? 'nav-link active' : 'nav-link'"
                         :to="{name : 'rankListIndex'}">排行榜
            </router-link>
          </li>
        </ul>
        <ul class="navbar-nav">
          <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown"
               aria-expanded="false">
              xiaoTao
            </a>
            <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
              <li>

                <router-link class="dropdown-item" :to="{name : 'userBotIndex'}">我的Bot</router-link>
              </li>
              <li>
                <hr class="dropdown-divider">
              </li>
              <li><a class="dropdown-item" href="#">退出</a></li>
            </ul>
          </li>
        </ul>
      </div>
    </div>
  </nav>

</template>

<script>
import {useRoute} from "vue-router";
import {computed} from "vue";

export default {
  setup() {
    const route = useRoute();
    let routeName = computed(() => route.name);
    return {
      routeName
    }
  }
}
</script>

<style scoped>

</style>